package com.taobao.tools;

import java.util.ArrayList;
import java.util.List;

public class OrderMap {

	private List<Object> keys = new ArrayList<Object>();
	private List<Object> values = new ArrayList<Object>();

	public int size() {
		return keys.size();
	}

	public void put(Object key, Object value) {
		keys.add(key);
		values.add(value);
	}

	public Object[] get(int index) {
		Object[] pairs = new Object[2];
		pairs[0] = keys.get(index);
		pairs[1] = values.get(index);
		return pairs;
	}
	
	public Object get(Object newKey) {
		int i = 0;
		for (Object key : keys) {
			if(key.equals(newKey)){
				return values.get(i);
			}
			i++;
		}
		return null;
	}
	
	public Object keySet(){
	    return keys;
	}
}
